import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '@/view/Login'
import Exam from '@/view/Exam'
import Test from '@/view/Test'
import Result from '@/view/Result'
import Log from '@/view/Log'

const routes = [
  { path: '/', redirect: '/login/:examId' },
  { name: 'Login', path: '/login/:examId', component: Login },
  { name: 'Exam', path: '/exam/:examId', component: Exam },
  { name: 'Test', path: '/test/:examId', component: Test },
  { name: 'Result', path: '/result/:examId', component: Result },
  { name: 'Log', path: '/log/:logId', component: Log },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes
})

router.beforeEach((to, from, next) => {
  next()
})

export default router
